<?php

namespace App\Admin\Controllers\Common;

use App\Models\CommonUserTag;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class UserTagController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '系统用户标签';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new CommonUserTag());

        $grid->column('id', ___('table.zy_common_user_tag.Id'));
        $grid->column('name', ___('table.zy_common_user_tag.Name'));
        $grid->column('create_time', ___('table.zy_common_user_tag.Create time'));
        $grid->column('update_time', ___('table.zy_common_user_tag.Update time'));
        $grid->quickCreate(function (Grid\Tools\QuickCreate $create) {
            $create->text('name', ___('table.zy_common_user_tag.Name'));
        });
        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(CommonUserTag::findOrFail($id));

        $show->field('id', ___('table.zy_common_user_tag.Id'));
        $show->field('name', ___('table.zy_common_user_tag.Name'));
/*        $show->field('create_time', ___('table.zy_common_user_tag.Create time'));
        $show->field('update_time', ___('table.zy_common_user_tag.Update time'));*/

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new CommonUserTag());

        $form->text('name', ___('table.zy_common_user_tag.Name'));

        return $form;
    }
}
